package com.caterina.runtime;
import java.util.Locale;

import com.caterina.activities.StartingActivity;
import com.caterina.activityManager.ActivityManager;
import com.caterina.resources.CPaths;
import com.caterina.resources.CWords;

import controllers.AsyncController;
import controllers.Log;
import controllers.caterinaController.CaterinaController;

public class CaterinaRuntime {	
	public static void start(){
		start(false);
	}
	public static void start(boolean debugMode){
		CPaths.ConvertUrl("url/uri.jar");
		CWords.setLocale(Locale.ITALIAN);
		Log.setEnabled(debugMode);
		CaterinaRuntime.debugMode=debugMode;
		controller= new AsyncController(new CaterinaController());
		manager =new ActivityManager(new StartingActivity(null),controller);
		manager.start();
	}
	public static void exit(){
		Runtime.getRuntime().exit(0);
	}
	public static void restart(){
		manager.toMain();
	}
	public static boolean isDebugMode(){
		return debugMode;
	}
	public static void setDebugMode(boolean enabled){
		debugMode=enabled;
	}
	private static boolean debugMode=false;
	private static ActivityManager manager;
	private static AsyncController controller;
}
